﻿package src.game.managers{
	import flash.geom.Rectangle;
	import src.game.Letter;

	public class ObjectRemover {
		private var gameArea:Rectangle;
		private var keyCode:int;
		
		public function ObjectRemover() {
			gameArea = new Rectangle(0, 0, 0, 0);
		}
		
		public function pressedKey(keyCode:int):void {
			this.keyCode = keyCode;
		}
		
		public function setGameArea(area:Rectangle):void {
			gameArea = area;
		}
		
		public function checkToRemove(element:Letter):Boolean {
			if ( element.getText().charCodeAt(0) == keyCode && !element.isBeingRemoved()) {
				return true;
			}
			return false;
		}
		
		public function isInArea(element:Letter):Boolean {
			if (element.x > 0 && element.x < gameArea.width && element.y < gameArea.height)
				return true;
			else
				return false;
		}
	}
	
}
